package ru.st.selenium.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;


public class AddFilmPage extends InternalPage {

        public AddFilmPage(PageManager pages) {
                super(pages);
        }
       
  @FindBy(name = "name")
  private WebElement titleField;
       
  @FindBy(name = "year")
  private WebElement yearField;
  
  @FindBy(name = "cast")
  private WebElement castField;
  
  @FindBy(name = "country")
  private WebElement countryField;
 
  @FindBy(name = "submit")
  private WebElement saveButton;

 
  public String getTitle() {
    return titleField.getAttribute("value");
  }

  public AddFilmPage setTitleField(String text) {
    titleField.sendKeys(text);
    return this;
  }

  public String getCast() {
    return castField.getAttribute("value");
  }
 
  public AddFilmPage setCastField(String text) {
	  castField.sendKeys(text);
            return this;
          }

  public String getYear() {
	    return yearField.getAttribute("value");
	  }
	 
	  public AddFilmPage setYearField(String text) {
	            yearField.sendKeys(text);
	            return this;
	          }
  public String getCountry() {
		    return countryField.getAttribute("value");
		  }
		 
	  public AddFilmPage setCountryField(String text) {
			  countryField.sendKeys(text);
		            return this;
		          }	    
	

  public void clickSaveButton() {
            saveButton.click();
          }

 
  public AddFilmPage ensurePageLoaded() {
    super.ensurePageLoaded();
    return this;
  }

}
